package com.zlyx.easy.weblog;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.zlyx.easy.asyn.annotations.MsgCustomer;
import com.zlyx.easy.asyn.interfaces.AsynMsgCustomer;
import com.zlyx.easy.core.console.Console;
import com.zlyx.easy.weblog.customer.ILogCustomer;

/**
 * @Auth 赵光
 * @Desc 日志采集器
 * @2018年12月13日 下午2:52:09
 */
@MsgCustomer(channels = { "weblog" })
public class LogAsynCustomer implements AsynMsgCustomer<String> {

	@Autowired
	private List<ILogCustomer> customers;

	@Override
	public void subscribe(String channel, String msgBody) {
		Console.log(channel, msgBody);
		if (customers != null && customers.size() > 0) {
			for (ILogCustomer customer : customers) {
				customer.handle(msgBody);
			}
		}
	}

}
